class Place
  attr_accessor :vehicule,:niveau,:longueur,:hauteur,:ticket
  attr_reader :id
  require './Modele/Vehicule'
  require "sqlite3"
  
  def initialize(id,db,niveau)
    @id = id
    result=db.execute("select * from Places where id=#{id}")
    if(result[0])    
      @niveau = result[0][2]
      result2=db.execute("select * from Vehicules where immatriculation='#{result[0][1]}'") 
      @vehicule=Vehicule.new(result2[0][0],result2[0][1],result2[0][2])
      @ticket = result[0][3]
    else
      @niveau = niveau
      @ticket=nil 
    end     
  end
  
  
  
  
  def is_empty
    vehicule==nil
  end
  
end